package models;

import java.util.Date;

import siena.Column;
import siena.Id;
import siena.Index;
import siena.Model;
import siena.Query;

/**
 * Representa uma mensagem Mobile-Originated
 * 
 * @author Aldrin Leal
 * 
 */
public class MensagemMO extends Model {
	@Id
	public Long oid;

	@Column("originator")
	@Index("originator_index")
	String originator;

	@Column("dateTime")
	Date dateTime;

	@Column("content")
	String content;

	@Column("usuarioId")
	String usuarioId = null;

	@Column("dataPublicacao")
	Date dataPublicacao = null;

	public String getOriginator() {
		return originator;
	}

	public void setOriginator(String originator) {
		this.originator = originator;
	}

	public Date getDateTime() {
		return dateTime;
	}

	public void setDateTime(Date dateTime) {
		this.dateTime = dateTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getUsuarioId() {
		return usuarioId;
	}

	public void setUsuarioId(String usuarioId) {
		this.usuarioId = usuarioId;
	}

	public Date getDataPublicacao() {
		return dataPublicacao;
	}

	public void setDataPublicacao(Date dataPublicacao) {
		this.dataPublicacao = dataPublicacao;
	}

	public static Query<MensagemMO> all() {
		return Model.all(MensagemMO.class);
	}
	
	public static Query<MensagemMO> outstandingMessages() {
		Query<MensagemMO> outstandingQuery = Model.all(MensagemMO.class);
		
		outstandingQuery.filter("dataPublicacao", null);
		outstandingQuery.filter("usuarioId", null);
		
		return outstandingQuery;
	}
}
